<template>
  <div class="insurance">
    <div class="header">
      <div class="table">
        <div class="tuo">
          <div class="tuo-1">
            <div class="tuo-2"></div>
            <span>保险列表</span>
          </div>
        </div>
        <!-- 保险列表 -->
        <div class="tables">
          <el-table
            :header-cell-style="{
              color: '#fff',
              background: '#6090EC',
              fontSize: '11px',
              fontWeight: 'normal',
              width: '100%',
            }"
            :data="auxiliary"
            size="mini"
            border
            stripe
            @selection-change="clickselect"
          >
            <el-table-column
              label="用户手机号"
              prop="userAccount"
              fixed
            ></el-table-column>
            <el-table-column
              label="用户名"
              prop="userName"
              fixed
            ></el-table-column>
            <el-table-column
              label="保险名称"
              prop="insuranceName"
              fixed
            ></el-table-column>
            <el-table-column
              label="保险"
              prop="insuranceCode"
            ></el-table-column>
            <el-table-column label="订单来源" prop="orderType">
              <template slot-scope="scope">
                <template v-if="scope.row.orderType == 'flight'"
                  >飞机票</template
                >
                <template v-if="scope.row.orderType == 'vipCard'"
                  >会员卡</template
                >
              </template>
            </el-table-column>
            <el-table-column label="订单id" prop="orderId"></el-table-column>
            <el-table-column label="保险类型" prop="insuranceType">
              <template slot-scope="scope">
                <template v-if="scope.row.insuranceType == 'ticket'"
                  >随票</template
                >
                <template v-if="scope.row.insuranceType == 'card'"
                  >随卡</template
                >
              </template>
            </el-table-column>
            <el-table-column
              label="保单号"
              prop="policyNumber"
            ></el-table-column>
            <el-table-column label="保单文件地址" prop="policyFileUrl">
              <template slot-scope="scope">
                <span
                  class="copyStyle"
                  v-if="scope.row.insuranceStatus != 'failure'"
                  @click="copyPolicyFileUrl(scope.row.policyFileUrl)"
                  >复制</span
                >
              </template>
            </el-table-column>
            <el-table-column
              label="被保人姓名"
              prop="insuredName"
            ></el-table-column>
            <el-table-column
              label="被保人证件号"
              prop="insuredIdNumber"
            ></el-table-column>
            <el-table-column
              label="被保人证件类型"
              prop="insuredPhone"
            ></el-table-column>
            <el-table-column
              label="被保人手机号"
              prop="insuredPhone"
            ></el-table-column>
            <el-table-column
              label="被保人生日"
              prop="insuredBirthday"
            ></el-table-column>
            <el-table-column label="开保状态" prop="insuranceStatus">
              <template slot-scope="scope">
                <template v-if="scope.row.insuranceStatus == 'success'"
                  >开保成功</template
                >
                <template v-if="scope.row.insuranceStatus == 'failure'"
                  >开保失败</template
                >
                <template v-if="scope.row.insuranceStatus == 'refund'"
                  >退保</template
                >
              </template>
            </el-table-column>
            <el-table-column
              label="投保日期"
              prop="insureTime"
            ></el-table-column>
            <el-table-column
              label="生效日期"
              prop="effectiveDate"
            ></el-table-column>
            <el-table-column
              label="失效日期"
              prop="failureDate"
            ></el-table-column>
            <el-table-column
              label="备注"
              prop="insuranceRemark"
            ></el-table-column>
          </el-table>
        </div>
         <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 15, 20]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="pageTotal"
    >
    </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "insurance",
  // 父子传递参数
  props: ["MembershipInformationData"],
  data() {
    return {
      userId: null,
      pageNo: 1,
        pageSize: 10,
        pageTotal:'',
      auxiliary: [],
    };
  },
  methods: {
    // 时间显示
    show(val) {
      var val1 = val.split(".");
      var val2 = val1[0].split("T").join(" ");
      return val2;
    },
    // 列表数据
    getguaranteeList() {
      this.$axios
        .getInsuranceRecordList({
          userId: this.userId,
          pageNo: this.pageNo,
          pageSize: this.pageSize,
        })
        .then((res) => {
          console.log(res);
          if (res.code == "00000") {
            this.auxiliary = res.data.records;
            this.pageTotal = res.data.total;
          }
        });
    },
    //
    copyPolicyFileUrl(val) {
      console.log(val);
      this.$copyText(val).then((e) => {
        this.$message({
          message: "复制成功",
          type: "success",
        });
      });
    },
       // 分页
    handleSizeChange(value) {
      this.pageSize = value;

      this.getguaranteeList();
    },
    handleCurrentChange(value) {
      this.pageNo = value;
      this.getguaranteeList();
    },
  },
  mounted() {
    this.userId = this.$route.params.customerId;
    this.getguaranteeList();
  },
};
</script>
<style scoped>
.insurance {
  height: 100vh;
  background-color: #f7f7f7;
}
.tuo {
  font-weight: bolder;
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}
.tuo-1 {
  display: flex;
}
.tuo-2 {
  width: 3.5px;
  height: 17px;
  background-color: #4b71bf;
  margin-top: 2px;
  margin-right: 4px;
  font-size: 12px;
  margin-bottom: 25px;
}
.table {
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 0.1px;
}
.tabs {
  margin-left: 20px;
  margin-right: 20px;
  padding-top: 20px;
}
.tables {
  margin-top: 10px;
  display: flex;
  /* justify-content:space-between; */
}
.tables-1 {
  margin-right: 10px;
  width: 40%;
}
.tables-2 {
  width: 60%;
}

.pop-9 {
  font-size: 11px;
  width: 60px;
  padding-top: 5px;
}
.pop-8 {
  font-size: 11px;
  width: 60px;
  padding-top: 10px;
}
.pop {
  margin-left: 20px;
}
.pop-1 {
  display: flex;
  width: 250px;
}
.pop-1-2 {
  display: flex;
  margin-bottom: 12px;
  margin-right: 10px;
}
.pop-2 {
  display: flex;
}
.pop-3 {
  margin-left: 10px;
  margin-top: 20px;
}
.too-1-1 {
  display: flex;
  margin-left: 20px;
  /* padding-top: 20px; */
  font-size: 20px;
}
.too {
  width: 3.5px;
  height: 22px;
  background-color: #4b71bf;
  margin-top: 2px;
  margin-right: 4px;
  margin-bottom: 25px;
}
.lan {
  margin-top: 5px;
  color: #2f80ed;
  font-size: 11px;
}
</style>
